﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;

namespace LightSO.ILibrary.Mapping
{
    /// <summary>
    /// 数据层自定义属性类
    /// </summary>
    public class DBDataSource : DapperQ.Mapping.DataSource
    {
        public virtual ProviderType ProviderType { get; set; }
    }

    public class MongoDataSource : DBDataSource
    {
        public string Collection { get; set; }
        public override ProviderType ProviderType
        {
            get
            {
                return ProviderType.MongoDb;
            }
            set
            {
                base.ProviderType = ProviderType.MongoDb;
            }
        }
    }

    public class RedisDataSource : DBDataSource
    {
        public int DB { get; set; }
        public override ProviderType ProviderType
        {
            get
            {
                return ProviderType.Redis;
            }
            set
            {
                base.ProviderType = ProviderType.Redis;
            }
        }
    }

    public class EFDataSource : DBDataSource
    {
        public virtual DbContext DbContext { get; set; }
        public override ProviderType ProviderType
        {
            get
            {
                return ProviderType.EF;
            }
            set
            {
                base.ProviderType = ProviderType.EF;
            }
        }
    }

    public enum ProviderType
    {
        DapperQ,
        MongoDb,
        Redis,
		EF,
    }
}





